#include "widget.h"
#include "./ui_widget.h"

#include "server.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
}

Widget::~Widget()
{
    delete ui;
}

//点击"发送文本消息"按钮的处理函数
void Widget::on_pushButton_clicked()
{
    WebsocketServer* websocketServer = WebsocketServer::getInstance();
    emit websocketServer->sendTextResp();
}

//点击"通知好友删除"按钮的处理函数
void Widget::on_pushButton_2_clicked()
{
    WebsocketServer* websocketServer = WebsocketServer::getInstance();
    emit websocketServer->sendFriendRemove();
}

//点击"通知好友申请"按钮的处理函数
void Widget::on_pushButton_3_clicked()
{
    WebsocketServer* websocketServer = WebsocketServer::getInstance();
    emit websocketServer->sendAddFriendApply();
}

//点击"通知同意好友申请"按钮的处理函数
void Widget::on_pushButton_4_clicked()
{
    WebsocketServer* websocketServer = WebsocketServer::getInstance();
    emit websocketServer->sendAddFriendProcess(true);
}

//点击"通知拒绝好友申请"按钮的处理函数
void Widget::on_pushButton_5_clicked()
{
    WebsocketServer* websocketServer = WebsocketServer::getInstance();
    emit websocketServer->sendAddFriendProcess(false);
}

//点击"通知会话创建"按钮的处理函数
void Widget::on_pushButton_6_clicked()
{
    WebsocketServer* websocketServer = WebsocketServer::getInstance();
    emit websocketServer->sendCreateChatSession();

}

//点击"发送图片消息"按钮的处理函数
void Widget::on_pushButton_7_clicked()
{
    WebsocketServer* websocketServer = WebsocketServer::getInstance();
    emit websocketServer->sendImageResp();
}

//点击"发送文件消息"按钮的处理函数
void Widget::on_pushButton_8_clicked()
{
    WebsocketServer* websocketServer = WebsocketServer::getInstance();
    emit websocketServer->sendFileResp();
}

//点击"发送语音消息"按钮的处理函数
void Widget::on_pushButton_9_clicked()
{
    WebsocketServer* websocketServer = WebsocketServer::getInstance();
    emit websocketServer->sendSpeechResp();
}

